package com.pug.user;

import com.pug.domain.KssUser;
import com.pug.domain.vo.KssUserVo;
import com.pug.result.R;
import com.pug.result.enums.AdminResultInterface;
import com.pug.result.enums.AdminSuccessResultEnum;
import com.pug.result.enums.AdminUserResultEnum;
import com.pug.service.user.KssUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
public class KssUserController {

    private final KssUserService kssUserService;

    @PostMapping("/toLogin")
    public R login(@RequestBody KssUserVo userVo){
        KssUser kssUser = kssUserService.login(userVo);
        if(kssUser==null){
            return R.fail(AdminUserResultEnum.USER_INPUT_ERROR);
        }
        return R.success(kssUser);
    }

}
